<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$info=pdo_get('yzzc_sun_order_set',array('uniacid'=>$_W['uniacid']));
if ($info['invoice_content']){
    $invoice_content = explode(',',$info['invoice_content']);
}
if ($info['invoice']){
    $info['invoice'] = explode(',',$info['invoice']);
}
$zj=explode(',',$info['zj']);

if(checksubmit('submit')){
    // var_dump(implode(",",$_GPC['zj']));die;
    if($_GPC['rule']==null){
        message('请您写完整订单说明及退改规则', '', 'error');
    }
/*    if($_GPC['know']==null){
        message('请您写完整取车须知','','error');
    }*/
    $data['uniacid']=$_W['uniacid'];
//    $data['long_prepay']=$_GPC['long_prepay'];
    $data['zlsz']=$_GPC['zlsz'];
    $data['tuimoney']=$_GPC['tuimoney'];
    $data['istui']=$_GPC['istui'];
//    $data['short_prepay']=$_GPC['short_prepay'];
    $data['rule']=$_GPC['rule'];
    $data['know']=$_GPC['know'];
    $data['service_desc']=$_GPC['service_desc'];
    $data['zx_service_desc']=$_GPC['zx_service_desc'];
    $data['getcar_desc']=$_GPC['getcar_desc'];
    $data['open_xz']=$_GPC['open_xz'];
    $data['xztime']=$_GPC['xztime'];
    $data['zchetong']=$_GPC['zchetong'];
    $data['depositway'] = $_GPC['depositway'];
    $data['deposit'] = $_GPC['deposit'];
    $data['close_time'] = $_GPC['close_time'];
    $data['hour_type'] = $_GPC['hour_type'];
//    $data['zj']=implode(",",$_GPC['zj']);
    $data['shuttle_type'] = $_GPC['shuttle_type'];
    $data['invoice_postage'] = $_GPC['invoice_postage'];
    $data['invoice_rate'] = $_GPC['invoice_rate'];
    $data['shuttle_commission'] = $_GPC['shuttle_commission'];
    if ($_GPC['invoice_content']){
        $data['invoice_content'] = implode(',',$_GPC['invoice_content']);
    }
    if ($_GPC['invoice']){
        $data['invoice'] = implode(',',$_GPC['invoice']);
    }
    if(empty($_GPC['id'])){
        $res = pdo_insert('yzzc_sun_order_set', $data,array('uniacid'=>$_W['uniacid']));

        if($res){
            message('添加成功',$this->createWebUrl('orderinfo',array()),'success');
        }else{
            message('添加失败','','error');
        }
    }else{

        $res = pdo_update('yzzc_sun_order_set', $data, array('uniacid'=>$_W['uniacid']));
    }
    if($res){
        message('修改成功',$this->createWebUrl('orderinfo',array()),'success');
    }else{
        message('修改失败','','error');
    }
}
include $this->template('web/orderinfo');